<?php

namespace app\Backend\controller;

use think\Controller;
use app\xt\Auth;
use app\common\model\Post as PostModel;
use app\common\model\Tag as TagModel;
use app\common\model\Comment as CommentModel;
class Index extends Controller
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
        $auth = Auth::getInstance();
        if (!$auth->check()) {
            $this->redirect('/admin/login');
        }

        // 统计
        $postCount = PostModel::count();
        $tagCount = TagModel::count();
        $commentCount = CommentModel::count();
        return view('index/index', compact('commentCount', 'tagCount', 'postCount'));
    }
}
